﻿#if UNITY_EDITOR
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
/// <summary>
/// 生成AssetBundle资源包
/// </summary>
public class EditorWindowBuildAssetBundle : AbsESF_EditorWindow
{
    /// <summary>
    /// 节点组
    /// </summary>
    static List<ESF_CollectAsset_AssetBundle> mNodes = null;

    protected override AbsESF_EditorBuildAsset config => ESF_Logic.assetBundleBuild;

    /// <summary>
    /// OnGUI
    /// </summary>
    protected override void OnRunGUI()
    {
        if (GUILayout.Button($"{ESF_enGUIDisplayWord.Setting.ESF_ToAlias()} AssetBundleSchema"))
        {
            ESF_MenuItem_AssetBundle.ESF_MenuItem_SetAssetBundleSchema();
        }
        if (GUILayout.Button(ESF_enGUIDisplayWord.Save.ESF_ToAlias()))
        {
            OnSaveConfig();
        }
        if (GUILayout.Button(ESF_enGUIDisplayWord.Load.ESF_ToAlias()))
        {
            mNodes = ESF_Logic.CollectAssetBundle<ESF_CollectAsset_AssetBundle>();
            ESF_Utility.ExecuteMenuAssetsRefresh();
        }
        if (mNodes != null)
        {
            EditorGUILayout.LabelField($"AssetBundle数量：{mNodes.Count}");            
        }

        if (GUILayout.Button($"{ESF_enGUIDisplayWord.Clear.ESF_ToAlias()} All  AssetBundleName"))
        {
            ESF_Logic.ClearAllAssetBundleName();
        }

        if (GUILayout.Button($"{ESF_enGUIDisplayWord.Build.ESF_ToAlias()}  SubPackJsonFile"))
        {
            ESF_Logic.BuildSubPackage();
        }

        if (GUILayout.Button($"{ESF_enGUIDisplayWord.OneKeyBuild.ESF_ToAlias()} AssetBundleName"))
        {
            ESF_Logic.OneKeyBuildAssetBundleName();
        }
        if (GUILayout.Button($"{ESF_enGUIDisplayWord.ReleasePackage.ESF_ToAlias()}"))
        {
            ESF_Logic.OneKeyBuildPipelineBuildAssetBundles();
        }

    }
}
#endif
